<?php
//=======================================
//###################################
// Kayako Web Solutions
//
// Source Copyright 2001-2004 Kayako Infotech Ltd.
// Unauthorized reproduction is not allowed
// License Number: $%LICENSE%$
// $Author: vshoor $ ($Date: 2005/08/07 05:20:29 $)
// $RCSfile: admin_dashboard.php,v $ : $Revision: 1.8 $ 
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//###################################
//=======================================

if (!defined("INSWIFT")) {
	trigger_error("Unable to process $PHP_SELF", E_USER_ERROR);
}

if (!$staffauth->isAdmin()) {
	trigger_error("You do not have permission to access $PHP_SELF", E_USER_ERROR);
}

$template->loadLanguageSection("dashboard");
$template->assign("isdashboard", true);

/**
* ###############################################
* ADMIN CP DASHBOARD
* ###############################################
*/
if ($eventaction == "dashboard")
{
$interface->adminHeader($_SWIFT["language"]["dashboard"], 1);

$interface->adminNavBar($_SWIFT["language"]["dashboard"], "", -1);

?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top">

<div class="dashboardtitle"><?=$_SWIFT["language"]["dashdashboard"]?></div>
<?
echo '<table cellspacing="0" cellpadding="0" border="0" width="100%" id="caltableopt">'.SWIFT_CRLF;
echo '<tr style="height: 1em;"><td align="left"><div id="tab_main" style="DISPLAY: block;" class="tabcontent">'.SWIFT_CRLF;
?>
<table cellspacing="0" cellpadding="4" border="0" width="100%" class="dashborder">
<tr style="height: 1em">
<td align="left" valign="top">

<table cellspacing="0" cellpadding="2" height="300" border="0" width="100%" class="dashcontent">
<tr><td align="left" valign="top">
<?
$_staffcount = $dbCore->queryFetch("SELECT COUNT(*) AS totalitems FROM `". TABLE_PREFIX ."staff`;");
$_departmentcount = $dbCore->queryFetch("SELECT COUNT(*) AS totalitems FROM `". TABLE_PREFIX ."departments`;");
$_tgroupcount = $dbCore->queryFetch("SELECT COUNT(*) AS totalitems FROM `". TABLE_PREFIX ."templategroups`;");
$_tcount = $dbCore->queryFetch("SELECT COUNT(*) AS totalitems FROM `". TABLE_PREFIX ."templates`;");
$_languagecount = $dbCore->queryFetch("SELECT COUNT(*) AS totalitems FROM `". TABLE_PREFIX ."languages`;");
$_phrasecount = $dbCore->queryFetch("SELECT COUNT(*) AS totalitems FROM `". TABLE_PREFIX ."languagephrases`;");
$_cfcount = $dbCore->queryFetch("SELECT COUNT(*) AS totalitems FROM `". TABLE_PREFIX ."customfields`;");
$_croncount = $dbCore->queryFetch("SELECT COUNT(*) AS totalitems FROM `". TABLE_PREFIX ."cron`;");

global $_DB;
$_dbsize = $_tablecount = 0;
$dbCore->query("SHOW TABLE STATUS FROM `". $dbCore->escape($_DB["name"]) ."`;");
while ($dbCore->nextRecord())
{
	$_tablecount++;
	$_dbsize += $dbCore->Record["Data_length"]+$dbCore->Record["Index_length"];
}

?>

		<table width="100%"  border="0" cellspacing="1" cellpadding="2"><tr>
		<td width="60" class="smalltext" nowrap><?=$_SWIFT["language"]["statistics"]?></td>
		<td valign="middle"><div class="linediv"><img src="<?=$_SWIFT["themepath"]?>space.gif" height="1" width="1" /></div></td></tr>
		</table>
		<table width="100%" border="0" cellspacing="1" cellpadding="2">
			<tr class="smalltext">
			<td width="150" class="row1" nowrap><?=$_SWIFT["language"]["dstaff"]?></td>
			<td class="row2"><a href="index.php?_m=core&_a=managestaff" id="moduletitle"><?=intval($_staffcount["totalitems"])?></a></td>
			<td width="150" class="row1" nowrap><?=$_SWIFT["language"]["ddepartments"]?></td>
			<td class="row2"><a href="index.php?_m=core&_a=managedepartments" id="moduletitle"><?=intval($_departmentcount["totalitems"])?></a></td>
			</tr>
			<tr class="smalltext">
			<td width="150" class="row1" nowrap><?=$_SWIFT["language"]["dtemplategroups"]?></td>
			<td class="row2"><a href="index.php?_m=core&_a=managetemplategroups" id="moduletitle"><?=intval($_tgroupcount["totalitems"])?></a></td>
			<td width="150" class="row1" nowrap><?=$_SWIFT["language"]["dtemplates"]?></td>
			<td class="row2"><a href="index.php?_m=core&_a=managetemplates" id="moduletitle"><?=intval($_tcount["totalitems"])?></a></td>
			</tr>
			<tr class="smalltext">
			<td width="150" class="row1" nowrap><?=$_SWIFT["language"]["dlanguages"]?></td>
			<td class="row2"><a href="index.php?_m=core&_a=managelanguages" id="moduletitle"><?=intval($_languagecount["totalitems"])?></a></td>
			<td width="150" class="row1" nowrap><?=$_SWIFT["language"]["dphrases"]?></td>
			<td class="row2"><a href="index.php?_m=core&_a=managephrases" id="moduletitle"><?=intval($_phrasecount["totalitems"])?></a></td>
			</tr>
			<tr class="smalltext">
			<td width="150" class="row1" nowrap><?=$_SWIFT["language"]["dcustomfields"]?></td>
			<td class="row2"><a href="index.php?_m=core&_a=managecfields" id="moduletitle"><?=intval($_cfcount["totalitems"])?></a></td>
			<td width="150" class="row1" nowrap><?=$_SWIFT["language"]["dtasks"]?></td>
			<td class="row2"><a href="index.php?_m=core&_a=managetasks" id="moduletitle"><?=intval($_croncount["totalitems"])?></a></td>
			</tr>
			<tr class="smalltext">
			<td width="150" class="row1" nowrap><?=$_SWIFT["language"]["dtables"]?></td>
			<td class="row2"><a href="index.php?_m=core&_a=repair" id="moduletitle"><?=intval($_tablecount)?></a></td>
			<td width="150" class="row1" nowrap><?=$_SWIFT["language"]["ddatabasesize"]?></td>
			<td class="row2"><a href="index.php?_m=core&_a=repair" id="moduletitle"><?=formattedSize($_dbsize)?></a></td>
			</tr>
		</table>

</td></tr>
</table>
</td>
</tr>
</table>
</div>
</td></tr>
</table>
</td>
<td align="right" valign="top" width="5"><img src="<?=$_SWIFT["themepath"]?>space.gif" border="0" width="5" height="5" /></td>
<td align="right" valign="top" width="20%"><div class="dashboardtitle"><?=$_SWIFT["language"]["dashproduct"]?></div>

<table cellspacing="0" cellpadding="4" border="0" width="100%" class="dashborder">
<tr style="height: 1em">
<td align="left" valign="top">

<table cellspacing="0" cellpadding="2" height="300" border="0" width="100%" class="dashcontent">
<tr><td align="left" valign="top">

	<table width="100%" border="0" cellspacing="1" cellpadding="2">
		<tr class="smalltext">
		<td width="75" nowrap><?=$_SWIFT["language"]["dproduct"]?></td>
		<td><?
		if (SWIFTPRODUCT == "SupportSuite")
		{
			echo '<img src="'. $_SWIFT["themepath"] .'small_supportsuite.gif" border="0" align="absmiddle" />&nbsp;';
		} else if (SWIFTPRODUCT == "LiveResponse") {
			echo '<img src="'. $_SWIFT["themepath"] .'small_liveresponse.gif" border="0" align="absmiddle" />&nbsp;';
		} else if (SWIFTPRODUCT == "eSupport") {
			echo '<img src="'. $_SWIFT["themepath"] .'small_esupport.gif" border="0" align="absmiddle" />&nbsp;';
		}
		echo SWIFTPRODUCT;
	?></td>
		</tr>
		<tr class="smalltext">
		<td nowrap><?=$_SWIFT["language"]["dversion"]?></td>
		<td><?=SWIFTVERSION?></td>
		</tr>
		<tr class="smalltext">
		<td nowrap><?=$_SWIFT["language"]["dbuildtype"]?></td>
		<td><?=BUILDTYPE?></td>
		</tr>
		<tr class="smalltext">
		<td nowrap><?=$_SWIFT["language"]["dbuilddate"]?></td>
		<td><?=BUILDDATE?></td>
		</tr>
	</table>


</td></tr></table>
</td></tr></table>

</td>
</tr>
</table>
<?

$interface->adminFooter();


}

?>